<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QRadioButton Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QRadioButton Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QRadioButton widget provides a radio button with a text
label. <a href="#details">More...</a></p>

<p>Inherits <a href="qabstractbutton.html">QAbstractButton</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qradiobutton.html#QRadioButton">__init__</a></b> (<i>self</i>, QWidget&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qradiobutton.html#QRadioButton-2">__init__</a></b> (<i>self</i>, QString&#160;<i>text</i>, QWidget&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" />bool <b><a href="qradiobutton.html#event">event</a></b> (<i>self</i>, QEvent&#160;<i>e</i>)</li><li><div class="fn" />bool <b><a href="qradiobutton.html#hitButton">hitButton</a></b> (<i>self</i>, QPoint)</li><li><div class="fn" /><b><a href="qradiobutton.html#initStyleOption">initStyleOption</a></b> (<i>self</i>, QStyleOptionButton&#160;<i>button</i>)</li><li><div class="fn" /><b><a href="qradiobutton.html#mouseMoveEvent">mouseMoveEvent</a></b> (<i>self</i>, QMouseEvent)</li><li><div class="fn" /><b><a href="qradiobutton.html#paintEvent">paintEvent</a></b> (<i>self</i>, QPaintEvent)</li><li><div class="fn" />QSize <b><a href="qradiobutton.html#sizeHint">sizeHint</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QRadioButton widget provides a radio button with a text
label.</p>
<p>A QRadioButton is an option button that can be switched on
(checked) or off (unchecked). Radio buttons typically present the
user with a "one of many" choice. In a group of radio buttons only
one radio button at a time can be checked; if the user selects
another button, the previously selected button is switched off.</p>
<p>Radio buttons are <a href="qabstractbutton.html#autoExclusive-prop">autoExclusive</a> by
default. If auto-exclusive is enabled, radio buttons that belong to
the same parent widget behave as if they were part of the same
exclusive button group. If you need multiple exclusive button
groups for radio buttons that belong to the same parent widget, put
them into a <a href="qbuttongroup.html">QButtonGroup</a>.</p>
<p>Whenever a button is switched on or off it emits the <a href="qabstractbutton.html#toggled">toggled</a>() signal. Connect to
this signal if you want to trigger an action each time the button
changes state. Use <a href="qabstractbutton.html#checked-prop">isChecked</a>() to see if a
particular button is selected.</p>
<p>Just like <a href="qpushbutton.html">QPushButton</a>, a radio
button displays text, and optionally a small icon. The icon is set
with <a href="qabstractbutton.html#icon-prop">setIcon</a>(). The
text can be set in the constructor or with <a href="qabstractbutton.html#text-prop">setText</a>(). A shortcut key can
be specified by preceding the preferred character with an ampersand
in the text. For example:</p>
<pre class="cpp">
 <span class="type">QRadioButton</span> <span class="operator">*</span>button <span class="operator">=</span> <span class="keyword">new</span> <span class="type">QRadioButton</span>(<span class="string">"Search from the &amp;cursor"</span><span class="operator">,</span> <span class="keyword">this</span>);
</pre>
<p>In this example the shortcut is <i>Alt+c</i>. See the <a href="qshortcut.html#mnemonic">QShortcut</a> documentation for details
(to display an actual ampersand, use '&amp;&amp;').</p>
<p>Important inherited members: <a href="qabstractbutton.html#text-prop">text</a>(), <a href="qabstractbutton.html#text-prop">setText</a>(), <a href="qabstractbutton.html#text-prop">text</a>(), <a href="qabstractbutton.html#down-prop">setDown</a>(), <a href="qabstractbutton.html#down-prop">isDown</a>(), <a href="qabstractbutton.html#autoRepeat-prop">autoRepeat</a>(), <a href="qabstractbutton.html#group">group</a>(), <a href="qabstractbutton.html#autoRepeat-prop">setAutoRepeat</a>(),
<a href="qabstractbutton.html#toggle">toggle</a>(), <a href="qabstractbutton.html#pressed">pressed</a>(), <a href="qabstractbutton.html#released">released</a>(), <a href="qabstractbutton.html#clicked">clicked</a>(), and <a href="qabstractbutton.html#toggled">toggled</a>().</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img alt="Screenshot of a Plastique radio button" src="images/plastique-radiobutton.png" /></td>
<td>A radio button shown in the <a href="gallery-plastique.html">Plastique widget style</a>.</td>
</tr>
<tr class="even" valign="top">
<td><img alt="Screenshot of a Windows XP radio button" src="images/windows-radiobutton.png" /></td>
<td>A radio button shown in the <a href="gallery-windowsxp.html">Windows XP widget style</a>.</td>
</tr>
<tr class="odd" valign="top">
<td><img alt="Screenshot of a Macintosh radio button" src="images/macintosh-radiobutton.png" /></td>
<td>A radio button shown in the <a href="gallery-macintosh.html">Macintosh widget style</a>.</td>
</tr>
</table>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QRadioButton" />QRadioButton.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a radio button with the given <i>parent</i>, but with
no text or pixmap.</p>
<p>The <i>parent</i> argument is passed on to the <a href="qabstractbutton.html">QAbstractButton</a> constructor.</p>


<h3 class="fn"><a name="QRadioButton-2" />QRadioButton.__init__ (<i>self</i>, QString&#160;<i>text</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a radio button with the given <i>parent</i> and a
<i>text</i> string.</p>
<p>The <i>parent</i> argument is passed on to the <a href="qabstractbutton.html">QAbstractButton</a> constructor.</p>


<h3 class="fn"><a name="event" />bool QRadioButton.event (<i>self</i>, <a href="qevent.html">QEvent</a>&#160;<i>e</i>)</h3><p>Reimplemented from <a href="qobject.html#event">QObject.event</a>().</p>


<h3 class="fn"><a name="hitButton" />bool QRadioButton.hitButton (<i>self</i>, <a href="qpoint.html">QPoint</a>)</h3><p>Reimplemented from <a href="qabstractbutton.html#hitButton">QAbstractButton.hitButton</a>().</p>


<h3 class="fn"><a name="initStyleOption" />QRadioButton.initStyleOption (<i>self</i>, <a href="qstyleoptionbutton.html">QStyleOptionButton</a>&#160;<i>button</i>)</h3><p>Initialize <i>option</i> with the values from this <a href="qradiobutton.html">QRadioButton</a>. This method is useful for
subclasses when they need a <a href="qstyleoptionbutton.html">QStyleOptionButton</a>, but don't want to
fill in all the information themselves.</p>
<p><b>See also</b> <a href="qstyleoption.html#initFrom">QStyleOption.initFrom</a>().</p>


<h3 class="fn"><a name="mouseMoveEvent" />QRadioButton.mouseMoveEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#mouseMoveEvent">QWidget.mouseMoveEvent</a>().</p>


<h3 class="fn"><a name="paintEvent" />QRadioButton.paintEvent (<i>self</i>, <a href="qpaintevent.html">QPaintEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#paintEvent">QWidget.paintEvent</a>().</p>


<h3 class="fn"><a name="sizeHint" /><a href="qsize.html">QSize</a> QRadioButton.sizeHint (<i>self</i>)</h3><p>Reimplemented from <a href="qwidget.html#sizeHint-prop">QWidget.sizeHint</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.8.0</td></tr></table></div></address></body></html>